home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Tools & Apps / Misc. Utilities / Installer / Installer 3.2 / Samples - Installer 3.2 / AppTooBigForOneFloppy.r < prev    next >
Encoding:
Text File  |  1992-01-22  |  12.1 KB  |  288 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2.  *
  3.  *    Apple Macintosh Developer Technical Support
  4.  *
  5.  *  Installer 3.2 sample: demonstrates file splitting
  6.  *
  7.  *    File:        AppTooBigForOneFloppy.r -    Rez Source
  8.  *
  9.  *    by:            Jon Zap
  10.  *
  11.  *    Copyright © 1991 Apple Computer, Inc.
  12.  *    All rights reserved.
  13.  *
  14.  *------------------------------------------------------------------------------
  15.  *
  16.  * Install application "TheProgram" into the folder "Root":Installed Application.
  17.  * It demonstrates both Easy and Custom Installation.  For the Easy Installation
  18.  * it checks the amount of target system memory and will not do the installation
  19.  * if there is less than 1mb.  There are two source floppies, each containing
  20.  * part of the application that is too large to fit on a single floppy.  The second
  21.  * floppy has a file that contains a number of resources that the application needs.
  22.  * each of these resources is moved into the app via an 'inra' resource.
  23.  * This relies on the fact that file atoms are installed before resource atoms.
  24.  * You cannot set the tgtRequired flag in the 'inra' resources because the installer
  25.  * will check before it installs any files.
  26.  *----------------------------------------------------------------------------*/
  27.  
  28. #include "Types.r"                    /* for the ICON resource */
  29. #include "InstallerTypes.r"
  30.  
  31. /* You can build the script with the following lines:
  32. # Note: set up floppies with the appropriate names and contents before running scriptcheck
  33. # or set up folders with the same names and contents as the floppies
  34. # put these folders in the same folder as the script or at the root directory of same disk
  35.  
  36.     rez -o "AppTooBigForOneFloppy" -t 'bjbc' -c 'bjbc' "AppTooBigForOneFloppy.r"
  37.     setfile -a i "AppTooBigForOneFloppy"        #mark Inited
  38.     scriptcheck -p "AppTooBigForOneFloppy"
  39. */
  40.  
  41. /* put a 1 in the creation date field of source 'infs' to have ScriptCheck set date */
  42. #define kScriptCheckSetsDate    0x01
  43. #define kMinMemMB                01    /* memory needed to install (UPDATE Error Message if changed!)*/
  44.  
  45. /* Definitions for the rules */
  46. #define rlCheckMemSize            1000
  47. #define rlOutputMemSizeError    1001
  48.  
  49. /* Definitions for the file spec atoms (specifications for source and destination files) */
  50. #define fsSourceProgram            2000
  51. #define fsTargetProgram            2001
  52. #define fsSourceProgRes1        2002
  53.  
  54. /* These are the names of the source disks */
  55. #define ProgramDisk1 "Program Disk 1:"
  56. #define ProgramDisk2 "Program Disk 2:"
  57.  
  58. /* where we want to install our file. */
  59. #define TargetPath    ":Installed Application:"
  60.  
  61. /* Definition for the package.  */
  62. #define pkTheProgram            3000
  63.  
  64. /* Definition for the file atom */
  65. #define faProgram                4000
  66.  
  67. /* Definitions for the resource atoms */
  68. #define raProgramRes1            5000
  69. #define raProgramRes2            5001
  70. #define raProgramRes3            5002
  71. #define raProgramRes4            5003
  72.  
  73. /* Definition for the package comment resource */
  74. #define cmtTheProgram            6000
  75.  
  76. /* October 10, 1990 is the current release date I put in 'icmt' rsrcs. ScriptCheck will convert     */
  77. /* this value to a LongInt seconds value needed by the Installer. */
  78. #define currentReleaseDate        10101990        
  79. #define currentVersion            100            /* Version 1.0 goes in the 'icmt' rsrc */
  80.  
  81. #define iconTheProgram            5100
  82.  
  83. /************************** Easy Install Rule resources **********************************/
  84. resource 'infr' (1) {
  85.     format0  {{
  86.         pickFirst,    {rlCheckMemSize, rlOutputMemSizeError}, /* Select only one of these rules */
  87.     }};
  88. };
  89.  
  90. resource 'inrl' (rlCheckMemSize) {
  91.     format0 {{
  92.         /* If the system has at least kMinMemMB megs of memory, then add the package */
  93.         checkMinMemory {kMinMemMB},
  94.         addUserDescription {"The Program\n"},    /* message to appear in Easy Install screen */
  95.         addPackages {{pkTheProgram}},            /* we're installing the program */
  96.     }};
  97. };
  98.  
  99. resource 'inrl' (rlOutputMemSizeError) {
  100.     format0 {{
  101.         /* This error message will be displayed on the Easy Install screen if this rule */
  102.         /* fires.  It fires if the first rule in this pickFirst group does not fire */
  103.         reportSysError {"To do installation you need:\n\n"},
  104.         reportSysError {"• At least 1 megabyte of memory\n"}
  105.     }};
  106. };
  107.  
  108. /***************************** Package Resources ************************************************/
  109. resource 'inpk' (pkTheProgram) {
  110.     format0 {
  111.         showsOnCustom,                 /* Package appears in the Custom Install display */
  112.         removable,                    /* Package can be removed */
  113.         dontForceRestart,            /* installing an app doesn't require rebooting */
  114.         cmtTheProgram,                 /* package's 'icmt' resource id */
  115.         0,                            /* Package size (filled in by ScriptCheck) */
  116.         "TheProgram", {                /* package name for package that shows on custom */
  117.             'infa', faProgram;
  118.             'inra', raProgramRes1;
  119.             'inra', raProgramRes2;
  120.             'inra', raProgramRes3;
  121.             'inra', raProgramRes4;
  122.         }
  123.     }
  124. };
  125.  
  126. /***************************** Comments ************************************************/
  127. resource 'icmt' (cmtTheProgram) {
  128.     currentReleaseDate,
  129.     currentVersion,
  130.     iconTheProgram,
  131.     "This package contains TheProgram."
  132. };
  133.  
  134. resource 'ICON' (iconTheProgram) {
  135.         $"0430 4000 0A50 A000 0B91 1002 0822 0803"
  136.         $"1224 0405 2028 0209 4010 0111 800C 00A1"
  137.         $"8003 FFC2 7E00 FF04 0100 7F04 0300 1E08"
  138.         $"04E0 000C 08E0 000A 10E0 0009 08C0 0006"
  139.         $"0487 FE04 0288 0104 0188 0084 0088 0044"
  140.         $"0088 0044 0088 00C4 0110 0188 0228 0310"
  141.         $"01C4 04E0 0002 0800 73BF FBEE 4CA2 8A2A"
  142.         $"40AA AAEA 52AA AA24 5EA2 8AEA 73BE FB8E",
  143. };
  144.  
  145.  
  146. /********************************************* File Specs ***************************************************/
  147. /* Source File Specs */
  148. resource 'infs' (fsSourceProgram) {
  149.     'APPL',                                /* File Type */
  150.     'Arfz',                                /* Creator */
  151.     kScriptCheckSetsDate,                /* ScriptCheck will fill in the creation date */
  152.     noSearchForFile,                    /* Do not search the source disk for the file */
  153.     typeCrMustMatch,                    /* The file type and creator on source disk must match */
  154.     ProgramDisk1"TheProgram"            /* Path to the file */
  155. };
  156.  
  157. resource 'infs' (fsSourceProgRes1) {
  158.     'rsrc',                                /* File Type */
  159.     'Arfz',                                /* Creator */
  160.     kScriptCheckSetsDate,                /* ScriptCheck tool will fill in the creation date */
  161.     noSearchForFile,                    /* Do not search the source disk for the file */
  162.     typeCrMustMatch,                    /* The file type and creator on source disk must match */
  163.     ProgramDisk2"TheProgramResources"    /* Path to the file */
  164. };
  165.  
  166. /* Target File Specs */
  167. resource 'infs' (fsTargetProgram) {
  168.     'APPL',                                /* File Type */
  169.     'Arfz',                                /* Creator */
  170.     0,                                    /* not needed for target file specs */
  171.     noSearchForFile,                    /* Do not search the target disk for the file */
  172.     typeCrMustMatch,                    /* not needed for target file specs */
  173.     TargetPath"TheProgram"                /* destination Path */
  174. };
  175.  
  176. /******************************************** File Atoms ************************************************/
  177. resource 'infa' (faProgram) {
  178.     format0 {
  179.         deleteWhenRemoving,                /* Delete the file if remove (option-custom) is clicked    */
  180.         dontDeleteWhenInstalling,         /* don't need to predelete the target before copying new one */
  181.         copy,                             /* Copy the file to the destination */
  182.         leaveAloneIfNewer,                 /* do not Install this version, if newer one exists */
  183.         updateExisting,                 /* replace an existing copy, if mine is newer */
  184.         copyIfNewOrUpdate,                /* Copy whether the target file exists or not */
  185.         rsrcFork, dataFork,                /* Copy both forks of the file */
  186.         fsTargetProgram,                /* TARGET file spec for this file */
  187.         fsSourceProgram,                 /* SOURCE file spec for this file */
  188.         0,                                /* atom size (filled in by ScriptCheck) */
  189.         ""                                /* Atom Description (for a file Installer will use file name) */
  190.     };
  191. };
  192.  
  193. /********************************** Resource Atoms **************************************************/
  194. resource 'inra' (raProgramRes1) {
  195.     format0 {
  196.         dontDeleteWhenRemoving,            /* dont need to delete the resource if remove (option-custom) is clicked */
  197.         dontDeleteWhenInstalling,         /* don't need to predelete the target before copying new one */
  198.         copy,                             /* Copy rsrc to destination */
  199.         noTgtRequired,                     /* Target file need not already exist on dest to install */
  200.         keepExisting,                     /* don't replace the rsrc (why is it there???) */
  201.         copyIfNewOrUpdate,                 /* Copy whether or not target rsrc already exists */
  202.         ignoreProtection,                /* Do it even if the target rsrc is protected (flag is ignored) */
  203.         srcNeedExist,                    /* Rsrc needs to exist on source disk */
  204.         byID,                            /* Use ID to find the rsrc */
  205.         nameNeedNotMatch,                /* Resource name need not match our specification */
  206.         fsTargetProgram,                /* Target file spec to install rsrc into */
  207.         fsSourceProgRes1,                /* Source file spec where to get rsrc */
  208.         'CODE',                            /* Resource type */
  209.         17,                             /* Resource source id */
  210.         17,                                /* Resource target id */
  211.         0,                                /* atom size (filled in by ScriptCheck) */
  212.         "",                                /* Atom description */                            
  213.         ""                                /* Resource name */
  214.     };
  215. };
  216. resource 'inra' (raProgramRes2) {
  217.     format0 {
  218.         dontDeleteWhenRemoving,            /* dont need to delete the resource if remove (option-custom) is clicked */
  219.         dontDeleteWhenInstalling,         /* don't need to predelete the target before copying new one */
  220.         copy,                             /* Copy rsrc to destination */
  221.         noTgtRequired,                     /* Target file need not already exist on dest to install */
  222.         keepExisting,                     /* don't replace the rsrc (why is it there???) */
  223.         copyIfNewOrUpdate,                 /* Copy whether or not target rsrc already exists */
  224.         ignoreProtection,                /* Do it even if the target rsrc is protected (flag is ignored) */
  225.         srcNeedExist,                    /* Rsrc needs to exist on source disk */
  226.         byID,                            /* Use ID to find the rsrc */
  227.         nameNeedNotMatch,                /* Resource name need not match our specification */
  228.         fsTargetProgram,                /* Target file spec to install rsrc into */
  229.         fsSourceProgRes1,                /* Source file spec where to get rsrc */
  230.         'CODE',                            /* Resource type */
  231.         16,                             /* Resource source id */
  232.         16,                                /* Resource target id */
  233.         0,                                /* atom size (filled in by ScriptCheck) */
  234.         "",                                /* Atom description */                            
  235.         ""                                /* Resource name */
  236.     };
  237. };
  238.  
  239. resource 'inra' (raProgramRes3) {
  240.     format0 {
  241.         dontDeleteWhenRemoving,            /* dont need to delete the resource if remove (option-custom) is clicked */
  242.         dontDeleteWhenInstalling,         /* don't need to predelete the target before copying new one */
  243.         copy,                             /* Copy rsrc to destination */
  244.         noTgtRequired,                     /* Target file need not already exist on dest to install */
  245.         keepExisting,                     /* don't replace the rsrc (why is it there???) */
  246.         copyIfNewOrUpdate,                 /* Copy whether or not target rsrc already exists */
  247.         ignoreProtection,                /* Do it even if the target rsrc is protected (flag is ignored) */
  248.         srcNeedExist,                    /* Rsrc needs to exist on source disk */
  249.         byID,                            /* Use ID to find the rsrc */
  250.         nameNeedNotMatch,                /* Resource name need not match our specification */
  251.         fsTargetProgram,                /* Target file spec to install rsrc into */
  252.         fsSourceProgRes1,                /* Source file spec where to get rsrc */
  253.         'CODE',                            /* Resource type */
  254.         9,                                 /* Resource source id */
  255.         9,                                /* Resource target id */
  256.         0,                                /* atom size (filled in by ScriptCheck) */
  257.         "",                                /* Atom description */                            
  258.         ""                                /* Resource name */
  259.     };
  260. };
  261.  
  262. resource 'inra' (raProgramRes4) {
  263.     format0 {
  264.         dontDeleteWhenRemoving,            /* dont need to delete the resource if remove (option-custom) is clicked */
  265.         dontDeleteWhenInstalling,         /* don't need to predelete the target before copying new one */
  266.         copy,                             /* Copy rsrc to destination */
  267.         noTgtRequired,                     /* Target file need not already exist on dest to install */
  268.         keepExisting,                     /* don't replace the rsrc (why is it there???) */
  269.         copyIfNewOrUpdate,                 /* Copy whether or not target rsrc already exists */
  270.         ignoreProtection,                /* Do it even if the target rsrc is protected (flag is ignored) */
  271.         srcNeedExist,                    /* Rsrc needs to exist on source disk */
  272.         byID,                            /* Use ID to find the rsrc */
  273.         nameNeedNotMatch,                /* Resource name need not match our specification */
  274.         fsTargetProgram,                /* Target file spec to install rsrc into */
  275.         fsSourceProgRes1,                /* Source file spec where to get rsrc */
  276.         'CODE',                            /* Resource type */
  277.         2,                                 /* Resource source id */
  278.         2,                                /* Resource target id */
  279.         0,                                /* atom size (filled in by ScriptCheck) */
  280.         "",                                /* Atom description */                            
  281.         ""                                /* Resource name */
  282.     };
  283. };
  284.  
  285.  
  286.  
  287.  
  288.